let married: boolean = false

let age: number = 10

let oname: string = 'jin'

let namelist: Array<string> = ['jin', 'ling', 'wang']
let arr2: number[] = [1, 2, 3, 4]

//元祖类型
let jin: [string, number, boolean] = ['jinyq', 10, false]
jin[0].length
jin[1].toFixed(2)

enum Gender {
	GIRL,
	BOY
}
console.log(`李雷是${Gender.BOY}`);
console.log(`韩梅梅是${Gender.GIRL}`);

enum Week {
	MONDAY = 1,
	TUESDAY = 2
}
console.log(`今天是星期${Week.MONDAY}`);

const enum Colors { BLUE, RED, YELLOW }
let myColors = [Colors.RED, Colors.YELLOW, Colors.BLUE]


let root: any = document.getElementById('root');
root.style.color = 'red';

let element: (HTMLElement | null) = document.getElementById('root');
// 非空断言
element!.style.color = 'green'

let x: number;
x = 1;
x = undefined;
x = null;

let y: number | null | undefined;
y = 1;
y = undefined;
y = null;


//never 代表不会出现的值
// 1.作为不会返回的函数的返回值类型
function error(message: string): never {
	throw new Error('报错');// 直接异常结束了。console不会出现
	console.log('ok')
}
function loop(): never {
	while (true) {

	}
}
function fn(x:number | string){
	if(typeof x === 'number'){
		console.log(x)
	}else if(typeof x === 'string'){
		console.log(x)
	}else{
		console.log(x) //never
	}
}
function greeting(name: string): void {
	console.log('hello', name);
	//当我们声明一个变量类型是 void 的时候，它的非严格模式(strictNullChecks:false)下仅可以被赋值为 null 和 undefined
	//严格模式(strictNullChecks:true)下只能返回undefined
	//return null;
	return undefined;
}
greeting('jin')


const s1 = Symbol('key')
const s2 = Symbol('key')

const max = Number.MAX_SAFE_INTEGER;
console.log(max + 1 === max + 2);
const max2 = BigInt(Number.MAX_SAFE_INTEGER);
console.log(max2 + 1n === max2 + 2n);

let foo: number;
let bar: bigint;
// foo =bar;
// bar = foo;